1. Field of the Invention
The present invention relates to an integrated circuit method and system for using neural networks for converting code to executable code.
2. Description of the Related Art
The Java** Platform provides an added layer of execution between the underlying operating system and programs written in the Java computer language. The Java Platform converts Java source code (.Java files) to bytecodes (.class files), which are machine independent representations of a Java class. Thus, the same bytecodes would be created for all operating system platforms. The bytecodes are then inputted to a Java Virtual Machine program that converts the bytecodes to the object code in the native machine language of the operating system on which the Java Virtual Machine is installed. Thus, there is a platform-specific Java Virtual Machine program for each platform on which Java programs can execute.
The Java Virtual Machine typically includes two components, an Interpreter and a Just-In-Time (JIT) Compiler. The bytecodes are either interpreted by the Interpreter or turned into native machine code by the JIT Compiler. The native code may then be executed to run the Java program. The JIT Compiler is intended to generate code faster for certain methods that are called frequently. The JIT operates by searching for strings having a recognizable pattern in the bytecodes. The JIT provides a mapping of such recognizable strings of bytecodes to native code statements. The JIT compiler reuses copies of translated bytecodes to speed up the compilation process. In this way, the JIT Compiler can quickly convert recognizable segments of the byte code to native code.
FIG. 1 illustrates the prior art method for converting Java source code to executable native machine code through the use of the Java Interpreter and JIT Compiler.
There is a need in the art for further improvements for compiling Java bytecodes into native code that may be executed by the native operating system platform on which the Java Virtual Machine is running.
To overcome the limitations in the prior art described above, preferred embodiments disclose an integrated circuit method and system for generating a compiler to map a code set to object code capable of being executed on an operating system platform. The integrated circuit is encoded with logic including at least one neural network. The at least one neural network in the integrated circuit is trained- to convert the code set to object code. The at least one trained neural network is then used to convert the code set to object code.
In further embodiments, the code set comprises Java bytecode implementing a Java class.
In still further embodiments, the at least one neural network embedded in the integrated circuit comprises a first level and second level neural networks. The first level neural networks are trained to convert the code set to a unique representation of the code set and the second level neural network is trained to convert the unique representation of the code set to the object code. After training, the first level neural networks are capable of being used to convert the code set to a unique representation of the code set and the second level neural network is capable of being used to convert the unique representation to the object code.
In yet further embodiments, the code set is parsed into a plurality of input vectors and each input vector is assigned to one of a plurality of first level neural networks. The first level networks are trained to convert the assigned input vector to an output vector. The combined output vectors from each first level neural network form a unique representation of the code set.
Preferred embodiments provide a mechanism for utilizing neural networks to provide a mapping from an input code set, such as Java bytecodes implementing a class, to native machine code The preferred embodiments are especially useful for substantially reducing the time needed to compile Java bytecodes into native machine code. The preferred embodiments avoid having to interpret any portion of the bytecodes. Instead, neural networks are utilized to map Java bytecodes to native machine code in a manner that is substantially faster than current Java Virtual Machine implementations using Interpreters and JIT Compilers. The neural networks of the preferred embodiments further reduce compilation time by parallel processing the input bytecodes and by providing a mapping that avoids the need for time consuming interpretation operations.
Still further, the preferred integrated circuit implementation includes logic to train the neural networks embedded in the integrated circuit to convert new Java classes or bytecodes into object code, thus allowing the integrated circuit to retrain the neural networks.